#include "acceptor.h"

void network::acceptor::handle_event(boost::shared_ptr<network::event> e) 
{
	// accepting the connection...
	boost::shared_ptr<network::tcp_socket> sock(
		boost::dynamic_pointer_cast<network::tcp_socket>(e->new_sock));
	boost::shared_ptr<network::parser> pars(
		network::singletone<network::configurator>::instance()->
			get_tcp_parser());
	boost::shared_ptr<network::receiver> recv(
		network::receiver::create(sock, _queue, pars));
	recv->add_listener(_cont);

	boost::shared_ptr<handler::music_handler> han(
		handler::music_handler::create(sock));
	_multi->add_handler(han);
	recv->add_listener(han);

	_cont->add(recv);
	recv->start_thread();
}

